<?php

include "vendor/autoload.php";
include "framework/common.php";
$setting = include "app/setting.php";
use Illuminate\Container\Container;
use Illuminate\Database\Capsule\Manager as Capsule;

echo date('Y-m-d H:i')."server init......\n";
$server = new framework\Server("0.0.0.0",80);




$database = $setting['database'];

$capsule = new Capsule;

// 创建链接
$capsule->addConnection($database);

// 设置全局静态可访问
$capsule->setAsGlobal();

// 启动Eloquent
$capsule->bootEloquent();

$db= new \Workerman\MySQL\Connection($database['host'], $database['port'], $database['username'],
    $database['password'], $database['database']);

$server->container['db'] = $db;
$server->route('/goods',array(\App\api\Goods::class,'index'));
//$server->default("_http_default", "custom data value");
echo date('Y-m-d H:i')."server runing......\n";
$server->run();
